<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>

</head>
<body>
<form action="http://localhost:3000/login" method="get">
    用户名：<input type="text" name="username" id="username">
    密  码：<input type="text" name="password" id="password">
    <input type="button" value="提交" id="btn">
</form>
<script src="../jquery.js"></script>

<script>
    $(function () {
        $("#btn").click(function () {
            var obj = {
                username:$('#username').val(),
                password:$('#password').val()

            }
            $.ajax({
                type:'post',
                url:'http://localhost:3000/login',
                contentType:'application/json',
                dataType:'text',
                data:$('form:eq(0)').serialize(),
//                  data:JSON.stringify(obj);
                success:function (data) {
                    console.log(data);
                }
            });
        });
    });
</script>
</body>
</html>